<template>
  <div class="divisional">
    <!-- 委外数据分配 -->
    <div class="search_box">
      <el-row :gutter="20">
        <el-form :inline="true" :model="paramsInfo" class="demo-form-inline" ref="paramsForm">
          <!-- <el-col :span="6">
            <el-form-item label="案件批次" prop='batchNumber'>
              <el-input v-model="paramsInfo.batchNumber" size="small"></el-input>
            </el-form-item>
          </el-col> -->
          <el-col :span="6">
            <el-form-item label="所属分行" prop='branch'>
              <el-select v-model="paramsInfo.branch" size="small" placeholder="请选择" @change="getSubBranchOptions" :disabled="branchDisable">
                <el-option key="不限" label="不限" value=""></el-option>
                <el-option v-for="item in branchOptions" :key="item.code" :label="item.name" :value="item.code"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="6">
            <el-form-item label="所属支行" prop='subBranch'>
              <el-select v-model="paramsInfo.subBranch" size="small" placeholder="请选择" :disabled="subBranchDisable">
                <el-option key="不限" label="不限" value=""></el-option>
                <el-option v-for="item in subBranchOptions" :key="item.code" :label="item.name" :value="item.code"></el-option>
              </el-select>
            </el-form-item>
          </el-col> -->
          <el-col :span="6">
            <el-form-item label="委外公司" prop='outCompanyName'>
              <el-input v-model.trim="paramsInfo.outCompanyName" size="small"></el-input>
            </el-form-item>
          </el-col>
        </el-form>
        <div align="left" style="padding-top: 4px;">
          <el-button type="primary" size="small" @click="search">查询</el-button>
          <el-button type="primary" size="small" @click="reset('paramsForm')">重置</el-button>
        </div>
      </el-row>
    </div>
    <div style="margin: 3px 3px 10px;font-size: 16px;font-size: 16px;cursor: pointer; width: 200px;" @click="showUnAllot">
      待分配数据，剩余<button style="cursor: pointer;"><span id="wfpajs">{{total3}}</span>条</button>。
    </div>
    <!-- 数据列表 -->
    <el-table
      v-loading="loading"
      element-loading-text="数据加载中"
      element-loading-spinner="el-icon-loading"
      element-loading-background="rgba(212, 216, 206, 1)"
      :header-cell-style="{background:'LightYellow	',color:'black'}"
      :data="tableData"
      style="width: 100%">
      <el-table-column label="序号" type="index" align="center" :index="getIndex"></el-table-column>
      <el-table-column label="批次号" prop="batchNumber" ></el-table-column>
      <el-table-column label="委外公司" prop="outCompanyName" ></el-table-column>
      <el-table-column label="案件数量" prop="anJianCount" ></el-table-column>

      <!-- <el-table-column label="分配时间" prop="allotDate" ></el-table-column> -->

      <el-table-column fixed="right" label="操作" width="150">
        <template slot-scope="scope">
          <el-button @click="detail(scope.row)" type="text" size="small">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="pageBox">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
        :page-sizes="[5, 10, 15,20]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
    </div>


    <el-dialog :visible.sync="showDetail" title="已分配案件" width="1400px">
      <div class="mainInfoBox">
        <div class="divisional">
          <div class="search_box" style="padding: 2px 10px;">
            <el-row :gutter="20">
              <el-form :inline="true" :model="allotedParams" class="demo-form-inline" ref="allotedParams">
                <el-col :span="6">
                  <el-form-item label="批次号" >
                    <el-input v-model="allotedParams.batchNumber" size="small" disabled></el-input>
                  </el-form-item>
                </el-col>

                <el-col :span="6">
                  <el-form-item label="委外公司" >
                    <el-input v-model="allotedParams.outCompanyName" size="small" disabled></el-input>
                  </el-form-item>
                </el-col>

                <el-col :span="6">
                  <el-form-item label="案件流水号" prop='serialNumber'>
                    <el-input v-model.trim="allotedParams.serialNumber" size="small"></el-input>
                  </el-form-item>
                </el-col>

                <el-col :span="6">
                  <el-form-item label="信用卡号" prop='cardNumber'>
                    <el-input v-model.trim="allotedParams.cardNumber" size="small"></el-input>
                  </el-form-item>
                </el-col>

                <el-col :span="6">
                  <el-form-item label="客户姓名" prop='name'>
                    <el-input v-model.trim="allotedParams.name" size="small"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="" >
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="" >
                  </el-form-item>
                </el-col>
                <el-col :span="6" >
                  <el-button type="primary" size="small" @click="search2">查询</el-button>
                  <el-button type="primary" size="small" @click="reset('allotedParams')">重置</el-button>
                  <el-button v-if="this.total2>0" type="primary" size="small" @click="exportData">审批</el-button>
                </el-col>
              </el-form>
            </el-row>
          </div>
        </div>
      </div>

      <el-divider content-position="left">案件列表</el-divider>
      <!-- 数据列表 -->

      <el-table
        v-loading="loading2"
        element-loading-text="数据加载中"
        element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(212, 216, 206, 1)"
        :header-cell-style="{background:'LightYellow	',color:'black'}"
        :data="listData"
        style="width: 100%;">
        <el-table-column label="序号" type="index" align="center" :index="getIndex2" width="100px"></el-table-column>
        <el-table-column label="案件流水号" prop="serialNumber" width="150px"></el-table-column>
        <el-table-column label="姓名" prop="name" width="150px"></el-table-column>
        <el-table-column label="身份证号" prop="identificationNumber" :formatter="hidInfo" width="150px"></el-table-column>
        <el-table-column label="信用卡号" prop="cardNumber" :formatter="hidInfo" width="150px"></el-table-column>
        <el-table-column label="卡类型" prop="allowType" width="150px" :formatter="cardTypeToZN"></el-table-column>
        <el-table-column label="贷款合同号" prop="contractNumber" width="150px"></el-table-column>
        <el-table-column label="开户机构" prop="accountOpeningInstitution" width="150px"></el-table-column>
        <el-table-column label="逾期欠款" prop="overdueArrears" width="150px"></el-table-column>
        <el-table-column label="逾期期数" prop="numberOfOverduePeriods" width="150px"></el-table-column>
        <el-table-column fixed="right" label="操作" width="150px">
          <template slot-scope="scope">
            <el-button @click="backData(scope.row)" type="text" size="small">取消</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="pageBox">
        <el-pagination @size-change="handleSizeChange2" @current-change="handleCurrentChange2" :current-page="currentPage2"
          :page-sizes="[10,15,20]" :page-size="pageSize2" layout="total, sizes, prev, pager, next, jumper" :total="total2"></el-pagination>
      </div>

    </el-dialog>

    <el-dialog :visible.sync="unAllot" title="待分配案件" width="70%">
      <div class="divisional">
        <div class="search_box" style="padding: 2px 10px;">
          <el-row :gutter="20">
            <el-form :inline="true" :model="params3" class="demo-form-inline" ref="params3">

              <el-col :span="6">
                <el-form-item label="案件流水号" prop='serialNumber'>
                  <el-input v-model.trim="params3.serialNumber" size="small"></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="6">
                <el-form-item label="卡类型" prop='allowType'>
                  <el-select v-model.trim="params3.allowType" size="small" placeholder="请选择">
                    <el-option v-for="item in cardTypes" :key="item.index" :label="item.label" :value="item.value"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="6">
                <el-form-item label="信用卡号" prop='cardNumber'>
                  <el-input v-model.trim="params3.cardNumber" size="small"></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="6">
                <el-form-item label="贷款合同号" prop='contractNumber'>
                  <el-input v-model.trim="params3.contractNumber" size="small"></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="6">
                <el-form-item label="客户姓名" prop='name'>
                  <el-input v-model.trim="params3.name" size="small"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="" >
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="" >
                </el-form-item>
              </el-col>
              <el-col :span="6" style="margin-top:37px;">
                <el-button type="primary" size="small" @click="search3">查询</el-button>
                <el-button type="primary" size="small" @click="reset('params3')">重置</el-button>
                <el-button type="primary" size="small" @click="allotData">分配案件</el-button>
              </el-col>
            </el-form>
          </el-row>
        </div>
      </div>



      <el-divider content-position="left">待分配案件列表</el-divider>
      <el-table
        v-loading="loading3"
        element-loading-text="数据加载中"
        element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(212, 216, 206, 1)"
        :header-cell-style="{background:'LightYellow	',color:'black'}"
        :data="list3"
        style="width: 100%;" @selection-change="handleSelectionChangeThree">
		<el-table-column type="selection" checked="true"></el-table-column>
        <el-table-column label="序号" type="index" align="center" :index="getIndex3"></el-table-column>
        <el-table-column label="案件流水号" prop="serialNumber" width="150px"></el-table-column>
        <el-table-column label="开户机构" prop="accountOpeningInstitution" width="150px"></el-table-column>
        <el-table-column label="信用卡号" :formatter="hidInfo" prop="cardNumber" width="150px"></el-table-column>
        <el-table-column label="卡类型" prop="allowType" width="150px" :formatter="cardTypeToZN"></el-table-column>
        <el-table-column label="贷款合同号" prop="contractNumber" width="150px"></el-table-column>
        <el-table-column label="身份证号" prop="identificationNumber" width="150px"></el-table-column>
        <el-table-column label="姓名" prop="name" width="150px"></el-table-column>
        <el-table-column label="逾期欠款" prop="overdueArrears" width="150px"></el-table-column>
        <el-table-column label="逾期期数" prop="numberOfOverduePeriods" width="150px"></el-table-column>
        <!-- <el-table-column fixed="right" label="操作" width="150">
          <template slot-scope="scope">
            <el-button @click="backData(scope.row)" type="text" size="small">撤回</el-button>
          </template>
        </el-table-column> -->
      </el-table>
      <div class="pageBox">
        <el-pagination @size-change="handleSizeChange3" @current-change="handleCurrentChange3" :current-page="currentPage3"
          :page-sizes="[10, 15,20]" :page-size="pageSize3" layout="total, sizes, prev, pager, next, jumper" :total="total3"></el-pagination>
      </div>


      <el-dialog
        width="30%"
        title="指定委外公司"
        :visible.sync="setCompany"
        append-to-body>
		<div class="mainInfoBox">
		  <div class="divisional">
			<el-row>
				<el-col :span="12">
				  <span class="inpText"></span>
				  <el-select v-model="companyName" size="small" placeholder="请选择" >
					<el-option v-for="item in companyOptions" :key="item.outsourcing_company" :label="item.outsourcing_company" :value="item.outsourcing_company" ></el-option>
				  </el-select>
				</el-col>
				<el-col :span="12" style="text-align: center;">
				  <el-button type="primary" size="small" @click="saveCompany">确定</el-button>
				</el-col>
			</el-row>
			</div>
		</div>
      </el-dialog>

    </el-dialog>
  </div>
</template>
<script>
  import {cmcUrl} from "../../../../static/baseUrl";
  import {Message} from "element-ui";
  const ExportJsonExcel = require('js-export-excel')
  export default {
    data() {
      return {
        branchDisable: false,
        subBranchDisable: false,
        branchOptions: [],
        subBranchOptions: [],
        paramsInfo: {
          outCompanyName: "",
          branch: "",
          subBranch: "",
        },
        stateOptions: [
          {
            text: "已分配",
            value: "1",
          },{
            text: "已回收",
            value: "2",
          }
        ],
        cardTypes: this.GLOBAL.cardTypeOptions,
        checkModelOptions: this.GLOBAL.checkModelOptions,
        loading: false,
        currentPage: 1,
        pageSize: 10,
        total: 0,
        tableData: [],
        allotedParams: {
          name: "",
          cardNumber: "",
          serialNumber: "",
        },//已分案查询条件
        showDetail: false,
        detailInfo: {},
        loading2: false,
        currentPage2: 1,
        pageSize2: 10,
        total2: 0,
        listData: [],
        //未分配案件页面参数
        unAllotNum: 0,
        unAllot: false,
        setCompany: false,
        params3: {
          serialNumber: "",
          allowType: "",
          cardNumber: "",
          name: "",
          contractNumber: "",
        },
        list3: [],
        loading3: false,
        currentPage3: 1,
        pageSize3: 10,
        total3: 0,
        companyOptions: [],//下发制定委外公司的下拉选
        companyName: "",
        selectedData: [],
        checkedIds: "",
        excelTitle:['批次号','案件流水号','姓名','身份证号','卡号','卡类型','贷款合同号','开户机构','逾期欠款','逾期期数','支行机构编码','分行机构编码'],//导出excel的表头，与excelColumn，需一一对应
        excelColumn:['batchNumber','serialNumber','name','identificationNumber','cardNumber','allowType','contractNumber','accountOpeningInstitution','overdueArrears','numberOfOverduePeriods','zhiInstitution','fenInstitution'],//导出excel每列对应的数据，
      }
    },
    created() {
      this.getBranchOptions();

      //this.refreshUnAllotNum();
      this.getList3();
    },
    methods: {
      //获取所有分行列表
      getBranchOptions(){
        let branch = localStorage.getItem('BRANCH');
        this.paramsInfo.branch = branch;

        this.$axios({
            method: "get",
            url: `/CMC/group/listFen`,
            data: "",
          })
          .then((res) => {
            console.log("获取分行数据==",res);
            if (res.code == 200) {
              this.branchOptions = res.data;

              if(branch){
                this.branchDisable = true;
              }
              //this.getSubBranchOptions(branch);
            } else {
              console.error("获取分行出错，，",res.message);
            }
            this.search();
          })
          .catch((err) => {console.log(err)});
      },
      //根据分行获取支行列表
      getSubBranchOptions(codeStr){

        if(codeStr){
          let ttt = this.branchOptions.find((element) => (element.code == codeStr));
          this.$axios({
              method: "get",
              url: `/CMC/group/listZhiByFen?id=`+ttt.id,
              data: "",
            })
            .then((res) => {
              console.log("获取支行信息==",res);
              if (res.code == 200) {
                let subBranch = localStorage.getItem('SUBBRANCH');
                this.paramsInfo.subBranch = subBranch;
                this.subBranchOptions = res.data;
                if(subBranch){
                  this.subBranchDisable = true;
                }
                this.search();
                //this.total = Number(res.data.total);
              } else {
                console.error("获取支行出错，，",res.message);
              }
            })
            .catch((err) => {console.log(err)});
          }
      },
      cardTypeToZN(row,column,cellValue,index){

        let ttt = this.cardTypes.find((element) => (element.value == cellValue));

        return ttt ? ttt.label : "";
      },
      handleCurrentChange(data) {
        this.currentPage = data;
        this.checkInfo();
      },
      handleSizeChange(data) {
        this.pageSize = data;
        this.checkInfo();
      },
      handleCurrentChange2(data) {
        this.currentPage2 = data;
        this.allotedList();
      },
      handleSizeChange2(data) {
        this.pageSize2 = data;
        this.allotedList();
      },
      handleCurrentChange3(data) {
        this.currentPage3 = data;
        this.getList3();
      },
      handleSizeChange3(data) {
        this.pageSize3 = data;
        this.getList3();
      },
      formatCheckModel(row){
        let vv = row.checkModel;
        let ttt = this.checkModelOptions.find((element) => (element.value == vv));
        return ttt ? ttt.label : "";
      },
      getIndex(index) {
        index = (index + 1) + (this.currentPage - 1) * this.pageSize;
        return index;
      },
      getIndex2(index) {
        index = (index + 1) + (this.currentPage2 - 1) * this.pageSize2;
        return index;
      },
      getIndex3(index) {
        index = (index + 1) + (this.currentPage2 - 1) * this.pageSize2;
        return index;
      },
      search(){
        this.currentPage = 1;
        this.checkInfo()
      },
      search2(){
        this.currentPage2 = 1;
        this.allotedList();
      },
      search3(){
        this.currentPage3 = 1;
        this.getList3();
      },
      reset(formRef){
        this.$refs[formRef].resetFields();
      },
      //主页面列表数据
      checkInfo(){
        this.$set(this.paramsInfo,"page",this.currentPage);
        this.$set(this.paramsInfo,"pageSize",this.pageSize);
        this.loading = true;
        this.$axios({
            method: "post",
            url: `/CMC/ourCompanyData/getOutData`,
            data: this.paramsInfo,
          })
          .then((res) => {
            this.loading = false;
            console.log(res, "数据详情");
            if (res.code == 200) {
              this.tableData = res.data.list;
              this.total = Number(res.data.total);
            } else {
              console.error(res.message);
            }

          })
          .catch((err) => {console.log(err)});
      },
      //详情
      detail(row){
        this.allotedParams = JSON.parse(JSON.stringify(row));
        console.log("this.allotedParams==",this.allotedParams);
        this.showDetail = true;
        this.search2();
      },
      //详情页面案件列表数据
      allotedList(){

        this.$set(this.allotedParams,"page",this.currentPage2);
        this.$set(this.allotedParams,"pageSize",this.pageSize2);
        this.loading2 = true;
        this.$axios({
            method: "post",
            url: `/CMC/ourCompanyData/OutCompanyDataInformation`,
            data: this.allotedParams,
          })
          .then((res) => {
            this.loading2 = false;
            console.log(res, "数据详情");
            if (res.code == 200) {
              this.listData = res.data.list;
              this.total2 = Number(res.data.total);
            } else {
              console.error(res.message);
            }

          })
          .catch((err) => {console.log(err)});
      },
      backData(rowData){
        this.$confirm("此操作将本条数据置为待分配案件, 是否继续?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          })
          .then(() => {
            console.log("已分配案件，撤回，rowData==",rowData);
            let id = rowData["id"];
            this.updateAllot(id,"");
            this.allotedList();
            this.getList3();
          })
          .catch(() => {});
      },

      showUnAllot(){
        this.unAllot = true;
        this.search3();
      },
      //刷新待分配案件数
      refreshUnAllotNum(){
        let option={
          page:1,
          pageSize:10,
        };
        this.$axios({
            method: "post",
            url: `/CMC/ourCompanyData/getCompanyNull`,
            data: option,
          })
          .then((res) => {
            console.log(res, "刷新待分配案件数");
            if (res.code == 200) {
              this.unAllotNum = Number(res.data.total);
            } else {
              console.error(res.message);
            }

          })
          .catch((err) => {console.log(err)});
      },
      //待分配按键列表
      getList3(){
        let branch = localStorage.getItem('BRANCH');
        let subBranch = localStorage.getItem('SUBBRANCH');

        this.$set(this.params3,"subBranch",subBranch);
        this.$set(this.params3,"branch",branch);
        this.$set(this.params3,"page",this.currentPage3);
        this.$set(this.params3,"pageSize",this.pageSize3);
        this.loading3 = true;
        this.$axios({
            method: "post",
            url: `/CMC/ourCompanyData/getCompanyNull`,
            data: this.params3,
          })
          .then((res) => {
            this.loading3 = false;
            console.log(res, "数据详情");
            if (res.code == 200) {
              this.list3 = res.data.list;
              this.total3 = Number(res.data.total);
            } else {
              console.error(res.message);
            }

          })
          .catch((err) => {console.log(err)});
      },
	  handleSelectionChangeThree(val) {
	    this.selectedData = val;
		console.log("this.checkedIds,,",this.checkedIds);
	  },


      //分配案件，指定委外公司
      allotData(){
        let idArr = [];
        let firstType = "";
        let flag = false;
        if(this.selectedData && this.selectedData.length>0){
          Object.keys(this.selectedData).forEach((item) => {
            console.log("this.selectedData==item=",item,"......,",this.selectedData[item]);
            let ttid = this.selectedData[item].id;
            let ttType = this.selectedData[item].allowType;
            idArr.push(ttid);
            if(item==0){
              firstType = ttType;//卡类型
            }else{
              if(ttType!=firstType){
                Message.warning("请选择同类型卡的数据进行操作！");
                flag = true;
                return;
              }
            }
          });
          if(!flag){
            this.checkedIds = idArr.join(); //join,默认用，分割
            console.log("firstType===",firstType);
            this.getCompanys(firstType);
          }
        } else {
          Message.warning("请选中数据后操作！");
          return;
        }
      },
      //撤回案件委外公司
      updateAllot(ids, companyName){
        let options = {
          ids: ids,
          companyName: companyName,
        }
        this.$axios({
            method: "post",
            url: `/CMC/ourCompanyData/updataCompanyNull`,
            data: options,
        })
        .then((res) => {
          console.log(res, "委外公司列表");
          if (res.code == 200) {
            Message.success("操作成功！");
            this.allotedList();
            this.checkInfo();
            //this.refreshUnAllotNum();
            this.getList3();
          } else {
          console.error(res.message);
          }
        })
        .catch((err) => {console.log(err)});
      },
      //获取可用的委外公司
      getCompanys(str){
        let branch = localStorage.getItem('BRANCH');
        if(!branch){//如果分行为空，设置为平台代码
          branch = localStorage.getItem('TENANT_CODE');
        }
        let options = {
          state: "1",//启用
          caseType: str,
          branch: branch,
        }
        this.$axios({
            method: "post",
            url: `/CMC/ourCompanyData/getCompanyBycaseType`,
            data: options,
          })
          .then((res) => {
            this.setCompany = true;
            console.log(res, "委外公司列表");
            if (res.code == 200) {
              this.companyOptions = res.data;
              //this.total2 = Number(res.data.total);
            } else {
              console.error(res.message);
            }

          })
          .catch((err) => {console.log(err)});
      },
	  saveCompany(){
      if(!this.companyName){
        Message.warning("请选择委外公司！");
        return;
      }

      let options = {
        ids: this.checkedIds,
        companyName: this.companyName,
      }
      this.$axios({
          method: "post",
          url: `/CMC/ourCompanyData/updataCompanyNull`,
          data: options,
      })
      .then((res) => {
        //console.log(res, "委外公司列表");
        if (res.code == 200) {
          Message.success("操作成功！");
          this.companyName = "";
          this.setCompany = false;
          this.companyOptions = [];
          this.search();
          this.getList3();
          //this.refreshUnAllotNum();
        //this.detailList = res.data.dataList;
        } else {
          console.error(res.message);
        }
        })
      .catch((err) => {console.log(err)});

	  },
    //导出数据
    exportData(){
      let msg="审批后将导出当前委外信息，确认审批吗?";
      //let removeid = data.id;
      this.$confirm(msg,"提示",{
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'success'
        }).then(()=>{
          this.exportExcel();

          this.showDetail = false;
          this.checkInfo();
        }).catch((err) => {console.log("err",err)});
    },
    exportExcel(){
      let options = {
        batchNumber: this.allotedParams.batchNumber,
        outCompanyName: this.allotedParams.outCompanyName,
        page: 1,
        pageSize: this.total2,
      };
      this.$axios({
          method: "post",
          url: `/CMC/ourCompanyData/OutCompanyDataInformation`,
          data: options,
        })
        .then((res) => {
          console.log(res, "导出数据");
          if (res.code == 200) {
            let totalData = res.data.list;
            Object.keys(totalData).forEach((item) => {
              console.log("totalData==item=",item,"......,",totalData[item]);

              let ttType = totalData[item].allowType;
              let typeStr = this.cardTypeToZN(null, null,ttType,null);
              this.$set(totalData[item], "allowType", typeStr);
            });
            let option={};
            option.fileName = this.allotedParams.batchNumber+'-'+this.allotedParams.outCompanyName;

            option.datas=[
              {
                sheetData: totalData,
                sheetName: '分案数据',
                sheetFilter: this.excelColumn,
                sheetHeader: this.excelTitle,
                columnWidths: [10,10,20,10]//对应的列宽，置为屏宽的百分比，40%
              },
            ];
            var toExcel=new ExportJsonExcel(option);
            toExcel.saveExcel();
            this.clearCompanyData();

          } else {
            console.error(res.message);
          }
        })
        .catch((err) => {console.log(err)});
      },
      //清除导出数据的委托记录
      clearCompanyData(){
        let options = {
          batchNumber: this.allotedParams.batchNumber,
          outCompanyName: this.allotedParams.outCompanyName,
        };
        this.$axios({
          method: "delete",
          url: `/CMC/ourCompanyData/deleteOutData`,
          data: options,
        })
        .then((res) => {
          if (res.code == 200) {
            //Message.success("导出成功！");
            this.checkInfo();
          } else {
            console.error(res.message);
          }
        })
        .catch((err) => {console.log(err)});
      }
    }
  }

</script>
<style lang="scss" scoped>

  .divisional {

    .search_box {
      background: #fff;
      border-radius: 10px;
      padding: 40px 40px 25px 40px;
      margin: 0 0 20px 0;
    }

    .pageBox {
      display: flex;
      width: 100%;
      justify-content: left;
      margin-top: 10px;
    }

    /deep/ .el-dialog {
      .mainInfoBox {
        width: 100%;
        max-height: 60vh;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        flex-wrap: wrap;
        overflow-y: auto;

        .infoBox {
          display: flex;
          flex-direction: row;
          justify-content: center;
          align-items: center;
          height: 40px;
          width: 30%;

          label {
            width: 100px;

            margin-right: 5px;
          }

          .el-input {
            flex: 1 1 auto;
          }
        }
      }
    }

  }



</style>
